package com.fanqiechaodan.factory.simple.factory;

import com.fanqiechaodan.factory.simple.product.Product;
import com.fanqiechaodan.factory.simple.product.ProductA;
import com.fanqiechaodan.factory.simple.product.ProductB;
import com.fanqiechaodan.factory.simple.product.ProductC;

/**
 * @author fanqiechaodan
 * @Classname SimpleFactory
 * @Description 工厂类
 */
public class SimpleFactory {

    public static Product createProduct(String type) {
        switch (type) {
            case "A":
                return new ProductA();
            case "B":
                return new ProductB();
            case "C":
                return new ProductC();
            default:
                throw new RuntimeException("不支持的产品类型:" + type);
        }

    }
}
